* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.container {
    display: flex;
    width: 100%;
    height: 100vh;
    justify-content: center;
    position: relative;
    align-items: center;

}

.box {
    background-color: red;
    position: absolute;
    width: 240px;
    height: 320px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s ease-in-out;
    border: 1px solid white;
}

.container:hover .box {
    transform: rotate(calc(var(--i)*5deg)) translate(calc(var(--i) * 120px), -50px);
}

.container .box:hover {
    translate: calc(calc(var(--i)) * 20px) -50px;
    z-index: 100;
}

.container.box.box-content {
    height: 100%;
    width: 100%;
}